﻿using System;
using System.Linq;
using System.Diagnostics.Contracts;

namespace Shweet.Repository
{
    public class Shweet
    {
        public string Text { get; set;}
        public string[] Tags { get; set; }
        public string User { get; set; }
        public DateTime ShweetedOn { get; set; }

        //This is used to provide custom contract verification
        //Refer to the code contracts documentation for more information
        [Pure]
        public bool IsValid()
        {
            return
                this.Text != null &&
                this.Tags != null && this.Tags.All(tag => tag != null) &&
                this.User != null;
        }
    }
}


